import { getNewsByIdAPI } from '../../api/news';
import { NEWS_SAVE_LIST } from './actionType';

// 2. 封装 需要触发的 action
export const getNewsByIdAction = (channel_id) => {
  //   异步需要返回的是 函数
  return async (dispatch) => {
    const res = await getNewsByIdAPI(channel_id);
    dispatch({ type: NEWS_SAVE_LIST, payload: res.data.results });
  };
};
